package com.by.controller;

import com.by.bean.Segmentation;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.SegmentationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "客户分类")
@RestController
@RequestMapping("/api")
@CrossOrigin
public class SegmentationController extends BaseController {
    @Autowired
    SegmentationService segmentationService;
    @ApiOperation("查询客户分类")
    @GetMapping("/segmentation")
    public ResultBean query(){
        List list = segmentationService.query();
        return success("客户分类列表",list);
    }
    @ApiOperation("修改分类占比")
    @PutMapping("/segmentation")
    public ResultBean update(@RequestBody Segmentation segmentation){
        int rs = segmentationService.update(segmentation);
        return updateResult(rs);
    }
}
